
/**
 * Aether3D
 * by Xavier Gouchet (2008)
 * Using P5Sunflow Library
 */

import hipstersinc.sunflow.*;
import hipstersinc.sunflow.shader.*;
import hipstersinc.*;

Aether3D shape;
float d2r = (2*PI)/360.0;

int SEED = 7; //3, 12, 19 33 50 56 60 74 
boolean sunflow = true;
boolean raw = false;

void setup(){
  if (sunflow){
    size(512, 512,"hipstersinc.P5Sunflow");
  } 
  else {
    size(400, 400, P3D); 
    //frameRate(1);
  }

  shape = new Aether3D();
}


void draw(){
  if (sunflow){
    P5Sunflow sunflow = (P5Sunflow) g;
    sunflow.camera.setType(SunflowCamera.THINLENS);
    if (raw){
      sunflow.scene.setAaMin(-2);
      sunflow.scene.setAaMax(-2);
      sunflow.scene.setAaSamples(1);
      sunflow.scene.setFilter(null);
      sunflow.scene.setIgiSamples(12);
    }
    else{
      sunflow.scene.setAaMin(0);
      sunflow.scene.setAaMax(1);
      sunflow.scene.setAaSamples(1);
      sunflow.scene.setFilter(SunflowScene.GAUSSIAN);
      sunflow.scene.setIgiSamples(16);
    }

  }
  
  background(0);
  noStroke();
  pushMatrix();
  
  translate(width/2, height/2,-200); 
  //rotateY(frameCount*0.01);
  fill(255);
  shape.drawAether(48,24);
  popMatrix();
  
  if (sunflow) saveFrame("output/aether3d_###.png");
}


